/**
 * Created by AMD on 20.11.14.
 */
package model.prototypes {
public class ShopObjectProto {

    private var _typemodel:String;
    private var _type:String;
    private var _model:String;
    private var _price:String

    private var _level:int;
    private var _occ_matrix:Array;
    private var _disabledSides:String;
    private var _spriteId:String;

    //name:"Basic shelf", price:"10g", volume:"4000", level:"1", occ_matrix:"[[0,0,0],[-1,1,-1],[0,0,0]]", extra:""
    public function ShopObjectProto(typemodel:String,spriteId:String, price:String, level:String, occ_matrix:String, disabledSides:String = null) {
        this._typemodel = typemodel;
        this._spriteId = spriteId;

        var _bufArr:Array = this._typemodel.split('_');

        this._type = _bufArr[0];
        this._model = _bufArr[1];

        this._price = price;

        this._level = int(level);
        this._occ_matrix = JSON.parse(occ_matrix) as Array;
        this._disabledSides = disabledSides;

    }

    public function get price():String {
        return _price;
    }



    public function get level():int {
        return _level;
    }

    public function get occ_matrix():Array {
        return _occ_matrix;
    }

    public function get typemodel():String {
        return _typemodel;
    }

    public function get model():String {
        return _model;
    }

    public function get type():String {
        return _type;
    }

    public function get disabledSides():String {
        return _disabledSides;
    }

    public function sideIsDisabled(angle:int):Boolean {
        if(this._disabledSides == null){
            return false;
        }
        return (this._disabledSides.indexOf(String(angle)) != -1)
    }

    public function get spriteId():String {
        return _spriteId;
    }
}
}
